#include "Light.h"
#include "STC8G_H_GPIO.h"

static void GPIO_config()
{
    P0_MODE_OUT_PP(GPIO_Pin_7);
    P5_MODE_OUT_PP(GPIO_Pin_2);
}

void Light_Init(void)
{
    GPIO_config();
    LED_R = 0;
    LED_L = 0;
}

void Light_on(LIGHT light)
{
    if (light == LIGHT_LEFT)
    {
        LED_L = 1;
    }
    else if (light == LIGHT_RIGHT)
    {
        LED_R = 1;
    }
    else if (light == LIGHT_ALL)
    {

        LED_L = 1;
        LED_R = 1;
    }
}

void Light_off(LIGHT light)
{
    switch(light){
		case LIGHT_LEFT: 
			LED_L = 0;
			break;
		case LIGHT_RIGHT: 
			LED_R = 0;
			break;
		case LIGHT_ALL: 
			LED_L = 0;
			LED_R = 0;
			break;
		default:
			break;
	}
}